<template>
	<view class="background"></view>
	<up-navbar title="我的售后" :autoBack="true"></up-navbar>
	<up-empty v-if="list.length == 0" style="margin-top: 400rpx;"></up-empty>
	<view class="list" style="margin-top: 180rpx;">
		<view class="quest" v-for="(item,index) in list">
			<view class="iconAndTextAndType">
				<view class="icon">
					<image src="@/static/quest/order/quest.png" mode="widthFix"></image>
				</view>
				<view class="text">编号：{{item.userServiceId}}</view>
				<view class="type">{{item.status == 0 ?"审核中":"审核完成"}}</view>
			</view>
			<view class="tap">任务详情</view>
			<view class="content">
				<view class="text">{{item.userQuestVo.content}}</view>
				<view class="picture">
					<up-album :urls="item.userQuestVo.cover" multipleSize="213rpx" singleSize="213rpx" space="10rpx"
						radius="31rpx"></up-album>
				</view>
			</view>
			<view class="tap">售后信息</view>
			<view class="content">
				<view class="text">备注：{{item.mark==null?"":item.mark}}</view> 
				<view class="picture">
					<up-album :urls="item.userQuestVo.cover" multipleSize="213rpx" singleSize="213rpx" space="10rpx"
						radius="31rpx"></up-album>
				</view>
			</view>
		</view>

		<up-divider text="没有更多"></up-divider>

	</view>

</template>
<script setup>
	import { onShow, onReachBottom } from '@dcloudio/uni-app';
	import api from '@/utlis/api.js';
	import { ref } from 'vue';
	import { fileUrl } from '@/utlis/config.js';

	const list = ref([]);
	const total = ref(0);
	const pageSize = ref(5);
	const pageNum = ref(0);




	onShow(() => {
		getQuest()
	});
	//页面触底
	onReachBottom(() => {
		if (list.value.length < total.value) {
			getQuest();
		}
	});

	const getQuest = () => {
		api("app/user/userservice/me/list", "GET", {
			pageSize: pageSize.value,
			pageNum: pageNum.value
		}).then(res => {
			for (var i = 0; i < res.rows.length; i++) {
				res.rows[i].userQuestVo.cover = res.rows[i].userQuestVo.cover.split(',');
				for (var j = 0; j < res.rows[i].userQuestVo.cover.length; j++) {
					res.rows[i].userQuestVo.cover[j] = fileUrl + res.rows[i].userQuestVo.cover[j];
				}
			}
			list.value.push(...res.rows);
			total.value = res.total;
			pageNum.value++;
			console.log(list.value)
		});
	}
</script>
<style lang="scss">
	.background {
		height: 100vh;
		width: 100vw;
		position: fixed;
		top: 0;
		background-color: #F7F7F7;
		z-index: -100;
	}

	.list {
		padding-bottom: 100rpx;
	}

	.quest {
		background-color: #FFFFFF;
		border-radius: 30rpx;
		padding: 20rpx;
		box-sizing: border-box;
		margin-top: 40rpx;
		font-size: 28rpx;

		.iconAndTextAndType {
			display: flex;
			flex-wrap: wrap;

			.icon {
				width: 40rpx;
				margin-right: 20rpx;

				image {
					width: 40rpx;
				}
			}

			.text {
				width: 400rpx;
				line-height: 40rpx;
			}

			.type {
				line-height: 40rpx;
				width: 250rpx;
				text-align: right;
			}
		}

		.tap {
			line-height: 50rpx;
			font-size: 30rpx;
			font-weight: 500;
		}

		.content {
			background: #F2F2F2;
			border-radius: 30rpx;
			padding: 20rpx;
			box-sizing: border-box;

			.text {
				overflow: hidden;
				display: -webkit-box;
				-webkit-line-clamp: 3;
				-webkit-box-orient: vertical;
				text-overflow: ellipsis;
			}

			.picture {
				margin-top: 20rpx;
			}
		}
	}
</style>